package sharedjplaylist.server.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2011-06-29 21:50:13")
/** */
public final class PlaylistMeta extends org.slim3.datastore.ModelMeta<sharedjplaylist.shared.model.Playlist> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist> DJName = new org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist>(this, "DJName", "DJName");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist> comment = new org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist>(this, "comment", "comment");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, java.util.Date> createDate = new org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, java.util.Date>(this, "createDate", "createDate", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist> datetime = new org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist>(this, "datetime", "datetime");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist> eventName = new org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist>(this, "eventName", "eventName");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist> genre = new org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist>(this, "genre", "genre");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist> password = new org.slim3.datastore.StringAttributeMeta<sharedjplaylist.shared.model.Playlist>(this, "password", "password");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, java.util.Date> updateDate = new org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, java.util.Date>(this, "updateDate", "updateDate", java.util.Date.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<sharedjplaylist.shared.model.Playlist, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final PlaylistMeta slim3_singleton = new PlaylistMeta();

    /**
     * @return the singleton
     */
    public static PlaylistMeta get() {
       return slim3_singleton;
    }

    /** */
    public PlaylistMeta() {
        super("Playlist", sharedjplaylist.shared.model.Playlist.class);
    }

    @Override
    public sharedjplaylist.shared.model.Playlist entityToModel(com.google.appengine.api.datastore.Entity entity) {
        sharedjplaylist.shared.model.Playlist model = new sharedjplaylist.shared.model.Playlist();
        model.setDJName((java.lang.String) entity.getProperty("DJName"));
        model.setComment((java.lang.String) entity.getProperty("comment"));
        model.setCreateDate((java.util.Date) entity.getProperty("createDate"));
        model.setDatetime((java.lang.String) entity.getProperty("datetime"));
        model.setEventName((java.lang.String) entity.getProperty("eventName"));
        model.setGenre((java.lang.String) entity.getProperty("genre"));
        model.setKey(entity.getKey());
        model.setPassword((java.lang.String) entity.getProperty("password"));
        java.util.ArrayList<sharedjplaylist.shared.model.Tunelist> _tunelist = blobToSerializable((com.google.appengine.api.datastore.Blob) entity.getProperty("tunelist"));
        model.setTunelist(_tunelist);
        model.setUpdateDate((java.util.Date) entity.getProperty("updateDate"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        sharedjplaylist.shared.model.Playlist m = (sharedjplaylist.shared.model.Playlist) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("DJName", m.getDJName());
        entity.setProperty("comment", m.getComment());
        entity.setProperty("createDate", m.getCreateDate());
        entity.setProperty("datetime", m.getDatetime());
        entity.setProperty("eventName", m.getEventName());
        entity.setProperty("genre", m.getGenre());
        entity.setProperty("password", m.getPassword());
        entity.setUnindexedProperty("tunelist", serializableToBlob(m.getTunelist()));
        entity.setProperty("updateDate", m.getUpdateDate());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        sharedjplaylist.shared.model.Playlist m = (sharedjplaylist.shared.model.Playlist) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        sharedjplaylist.shared.model.Playlist m = (sharedjplaylist.shared.model.Playlist) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        sharedjplaylist.shared.model.Playlist m = (sharedjplaylist.shared.model.Playlist) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        sharedjplaylist.shared.model.Playlist m = (sharedjplaylist.shared.model.Playlist) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        sharedjplaylist.shared.model.Playlist m = (sharedjplaylist.shared.model.Playlist) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getDJName() != null){
            writer.setNextPropertyName("DJName");
            encoder0.encode(writer, m.getDJName());
        }
        if(m.getComment() != null){
            writer.setNextPropertyName("comment");
            encoder0.encode(writer, m.getComment());
        }
        if(m.getCreateDate() != null){
            writer.setNextPropertyName("createDate");
            encoder0.encode(writer, m.getCreateDate());
        }
        if(m.getDatetime() != null){
            writer.setNextPropertyName("datetime");
            encoder0.encode(writer, m.getDatetime());
        }
        if(m.getEventName() != null){
            writer.setNextPropertyName("eventName");
            encoder0.encode(writer, m.getEventName());
        }
        if(m.getGenre() != null){
            writer.setNextPropertyName("genre");
            encoder0.encode(writer, m.getGenre());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getPassword() != null){
            writer.setNextPropertyName("password");
            encoder0.encode(writer, m.getPassword());
        }
        if(m.getTunelist() != null){
            writer.setNextPropertyName("tunelist");
            // sharedjplaylist.shared.model.Tunelist is not supported.
        }
        if(m.getUpdateDate() != null){
            writer.setNextPropertyName("updateDate");
            encoder0.encode(writer, m.getUpdateDate());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    protected sharedjplaylist.shared.model.Playlist jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        sharedjplaylist.shared.model.Playlist m = new sharedjplaylist.shared.model.Playlist();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("DJName");
        m.setDJName(decoder0.decode(reader, m.getDJName()));
        reader = rootReader.newObjectReader("comment");
        m.setComment(decoder0.decode(reader, m.getComment()));
        reader = rootReader.newObjectReader("createDate");
        m.setCreateDate(decoder0.decode(reader, m.getCreateDate()));
        reader = rootReader.newObjectReader("datetime");
        m.setDatetime(decoder0.decode(reader, m.getDatetime()));
        reader = rootReader.newObjectReader("eventName");
        m.setEventName(decoder0.decode(reader, m.getEventName()));
        reader = rootReader.newObjectReader("genre");
        m.setGenre(decoder0.decode(reader, m.getGenre()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("password");
        m.setPassword(decoder0.decode(reader, m.getPassword()));
        reader = rootReader.newObjectReader("tunelist");
        reader = rootReader.newObjectReader("updateDate");
        m.setUpdateDate(decoder0.decode(reader, m.getUpdateDate()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        return m;
    }
}